package com.gloaba.common.mongo.base;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Field;
import org.springframework.data.mongodb.core.mapping.FieldType;

import java.io.Serializable;
import java.util.Date;

@Data
public class BaseMongoEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @Field("_id")
    private String id;

    /**
     * 创建时间
     */
    @Field(value = "created_time",targetType = FieldType.DATE_TIME)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 创建人
     */
    @Field(value = "created_by",targetType = FieldType.STRING)
    private String createBy;


    /**
     * 修改时间
     */
    @Field(value = "updated_time",targetType = FieldType.DATE_TIME)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /**
     * 修改人
     */
    @Field(value = "updated_by",targetType = FieldType.STRING)
    private String updateBy;

}
